#ifndef __SERIAL_H
#define __SERIAL_H
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>
#include "stm32f10x.h"    
#include "esp8266.h"
extern uint8_t a;
extern uint8_t flag;
extern uint8_t colour;

void Serial_Init(void);
void Serial_SendByte(uint8_t Byte);
void Serial_SendArray(uint8_t *Array, uint16_t Length);
void Serial_SendString(char *String);
void Serial_SendNumber(uint32_t Number, uint8_t Length);
void Serial_Printf(char *format, ...);

#define USART1_MAX_RECV_LEN		400					//?????????
#define USART1_MAX_SEND_LEN		400					//?????????
#define USART1_RX_EN 			1					//0,???;1,??.

extern u8  USART1_RX_BUF[USART1_MAX_RECV_LEN]; 		//????,??USART2_MAX_RECV_LEN??
extern u8  USART1_TX_BUF[USART1_MAX_SEND_LEN]; 		//????,??USART2_MAX_SEND_LEN??
extern u16 USART1_RX_STA;   						//??????

void usart1_Init(u32 bound);
void usart1_Send_Byte(uint8_t byte);

uint8_t Serial_GetRxFlag(void);
uint8_t Serial_GetRxData(void);

_Bool ESP8266_WaitRecive(void);
_Bool usart1_Send_String(unsigned char *string, char *res);
#endif
